import matplotlib.pyplot as plt
import random
import numpy as np

x_1 = np.arange(0,12.1,0.1)
y_1 = np.sin(x_1)

x_2 = np.arange(0,12.1,0.1)
y_2 = np.cos(x_2)

x_3 = np.arange(0,12.1,0.1)
y_3 = np.tan(x_3)

y_4 = [i + random.random() for i in range(10)]

n = 2
N = 4

y_list = [y_1,y_2,y_3,y_4]
color_list = ['red','blue','#FFB6C1','#E6E6FA']
fig , axes = plt.subplots(2,2)

# 绘制任意 n*n 张图 eg:3*3
for idx in range(N):
    axes[idx // n][idx % n].plot(y_list[idx],color=color_list[idx])
    axes[idx // n][idx % n].legend()

plt.show()
# 绘制任意 m*n 张图 eg:2*5 or 5*2


